package leetcode.offer;

import java.util.Arrays;

/**
 * ClassName: MissingNumber
 * Description: leetcode-剑指offer 53 - II 0~n-1中缺失的数字
 * date: 2021-11-01 9:09
 *
 * @author liyifan
 */
public class MissingNumber {
    public int missingNumber(int[] nums) {
        int sum = (1 + nums.length) * nums.length / 2;
        return sum - Arrays.stream(nums).sum();
    }
}
